#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QProcess>
#include <QStringList>
#include <QTime>

#include <memory>


#include "sys_data_struct.h"
#include "EEG_device.h"
#include "stateMonitorWidget.h"
#include "DropoutDetectionWidget.h"
#include "waveWidget.h"
#include "regulationWidget.h"
// #include "SimEEG_device.h"
#include "EEGDataRelay.h"
#include "EmoRecogCore.h"
#include "PlayWidget.h"

#include "BackgroundProgram.h"

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

protected:
    bool eventFilter(QObject *obj, QEvent *ev);

signals:
    // void startCollecting(void* pContext);
    void send_collectingState(bool state);
    // void showGraph(int,bool);
    void setEmoRecMode(EmoRecogCore::WorkingMode mode);

// private slots:
private slots:
    void on_btn_start_clicked(bool checked);
    void on_btn_stateMonitor_clicked(bool checked);
    void on_btn_wave_clicked(bool checked);
    void on_btn_dropoutDetection_clicked(bool checked);
    void on_btn_eegCollect_clicked(bool checked);
    void on_btn_regulation_clicked(bool checked);

    void event_widgetClose(uint8_t winID);
    void noiseLabel();


public slots:
    void test_showEmoLabel();
    // void plotDataUpdate();


    // void play_train_video();

private:
    Ui::MainWindow *ui;
    // 点击开始播放视频前，做一个短延时
    QTimer delay_playVideoTimer;
    QTimer timer_simNetwork;
    QTimer timer_Network;


private:
    u_int8_t win_open_flag;
    bool collecting_flag;

    // CollectData* eeg_dev1;
    // EEG_device* eeg_dev1;
    // SimEEG_device* sim_eeg_dev;
    EEGDataRelay* eegDataRelay;
    StateMonitorWidget* stateMonitorWidget_ui;
    DropoutDetectionWidget* dropoutDectectionWidget_ui;
    WaveWidget *waveWidget_ui;
    EmoRecogCore *emoRecogCore;
    PlayWidget *playwin;
    RegulationWidget *regulationWidget_ui;

    int label_group[3] = {-1,0,1};

    // 更新
public:

private:
    BackgroundProgram program;

    // timer
    QTimer timer_plotAddData;
    


};

#endif // MAINWINDOW_H
